﻿<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog"
    aria-labelledby="createOrEditModal" aria-hidden="true" [config]="{backdrop: 'static', keyboard: !saving}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <form *ngIf="active" #orderForm="ngForm" (ngSubmit)="save()">
                <div class="modal-header">
                    <h4 class="modal-title">
                        <span *ngIf="order.id">编号: {{order.id}}</span>
                        <span *ngIf="!order.id">新添任务</span>
                    </h4>
                    <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')"
                        [disabled]="saving">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="row m--margin-top-20">
                        <div class="col-md-6 ">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="picNo">
                                    图号
                                </label>
                                <input id="picNo" #picNoInput="ngModel" type="text" name="PicNo" class="form-control"
                                    [(ngModel)]="order.picNo" placeholder="产品图号" required maxlength="32">
                                <validation-messages [formCtrl]="picNoInput"></validation-messages>
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="picNo">
                                    任务号
                                </label>
                                <input id="taskNo" #taskNoInput="ngModel" type="text" name="TaskNo" class="form-control"
                                    [(ngModel)]="order.taskNo" placeholder="产品任务号" required maxlength="32">
                                <validation-messages [formCtrl]="taskNoInput"></validation-messages>
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="name">
                                    名称
                                </label>
                                <input id="name" #nameInput="ngModel" type="text" name="Name" class="form-control"
                                    [(ngModel)]="order.name" placeholder="产品名称" maxlength="64">
                                <validation-messages [formCtrl]="nameInput"></validation-messages>
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="size">
                                    尺寸
                                </label>
                                <input id="size" #sizeInput="ngModel" type="text" name="Size" class="form-control"
                                    [(ngModel)]="order.size" placeholder="产品尺寸" maxlength="64">
                                <validation-messages [formCtrl]="sizeInput"></validation-messages>
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="amount">
                                    数量
                                </label>
                                <input id="amount" #amountInput="ngModel" type="number" name="Amount" class="form-control"
                                    [(ngModel)]="order.amount" placeholder="需求数量" required  >
                                <validation-messages [formCtrl]="amountInput"></validation-messages>
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="DeliveryTime">
                                    交付日期
                                </label>                            
                                <input class="form-control" id="DeliveryTime" name="DeliveryTime" type="text" #deliveryDatePicker bsDatepicker
                                    [(ngModel)]="deliveryTime">
                            
                            </div>
                        </div>
                        <div class="col-md-6 m--margin-bottom-10">
                            <div class="form-group m-form__group m--margin-10">
                                <label for="customer">
                                    需求方
                                </label>
                                <select #customerCombobox id="customer" name="customer" class="form-control"
                                    [(ngModel)]="order.customerId">
                                    <option value="">{{emptyText}}</option>
                                    <option *ngFor="let custom of customers" [value]="custom.value"
                                        [attr.data-icon]="custom.value">{{custom.displayText}}</option>
                                </select>

                            </div>
                        </div>
                    </div>

                </div>
                <div class="modal-footer">
                    <button [disabled]="saving" type="button" class="btn btn-default"
                        (click)="close()">{{"Cancel" | localize}}</button>
                    <button type="submit" class="btn btn-primary" [disabled]="!orderForm.form.valid"
                        [buttonBusy]="saving" [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i>
                        <span>{{"Save" | localize}}</span></button>
                </div>
            </form>
        </div>
    </div>
</div>